package com.example.erhuo;

import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

import java.io.Serializable;

public class Good implements Parcelable {
    private String title;
    private String description;
    private String price;
    private String category;
    private String uploadTime;
    private String status;
    private String senderId;
    private String id;
    private String imagePATH = null;
    private Bitmap image = null;

    private String wantNum;


    public Good() {
    }

    public Good(String title, String price, String description, String category, String uploadTime, String status, String senderId, String id, String imagePATH) {
        this.category = category;
        this.title = title;
        this.price = price;
        this.description = description;
        this.uploadTime = uploadTime;
        this.status = status;
        this.senderId = senderId;
        this.id = id;
        this.imagePATH = imagePATH;
    }

    protected Good(Parcel in) {
        title = in.readString();
        description = in.readString();
        price = in.readString();
        category = in.readString();
        uploadTime = in.readString();
        status = in.readString();
        senderId = in.readString();
        id = in.readString();
        imagePATH = in.readString();
        image = in.readParcelable(Bitmap.class.getClassLoader());
    }

    public static final Creator<Good> CREATOR = new Creator<Good>() {
        @Override
        public Good createFromParcel(Parcel in) {
            return new Good(in);
        }

        @Override
        public Good[] newArray(int size) {
            return new Good[size];
        }
    };

    public Bitmap getImage() {
        return image;
    }

    public void setImage(Bitmap image) {
        this.image = image;
    }

    public String getCategory() {
        return category;
    }

    public String getDescription() {
        return description;
    }

    public String getTitle() {
        return title;
    }

    public String getPrice() {
        return price;
    }

    public String getUploadTime() {
        return uploadTime;
    }

    public String getSenderId() {
        return senderId;
    }

    public String getStatus() {
        return status;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setName(String title) {
        this.title = title;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public void setUploadTime(String uploadTime) {
        this.uploadTime = uploadTime;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getId() {
        return id;
    }

    public String getImagePATH() {
        return imagePATH;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setImagePATH(String imagePATH) {
        this.imagePATH = imagePATH;
    }

    public String getWantNum() {
        return wantNum;
    }

    public void setWantNum(String wantNum) {
        this.wantNum = wantNum;
    }

    @Override
    public int describeContents() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        // TODO Auto-generated method stub
        dest.writeString(title);
        dest.writeString(description);
        dest.writeString(price);
        dest.writeString(category);
        dest.writeString(uploadTime);
        dest.writeString(status);
        dest.writeString(senderId);
        dest.writeString(id);
        dest.writeString(imagePATH);
        dest.writeString(wantNum);
        dest.writeParcelable(image, flags);
    }
}
